package com.situ.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.mvc.common.ServerResponse;
import com.situ.mvc.entity.Department;
import com.situ.mvc.service.IDepartmentService;
import com.situ.mvc.service.impl.DepartmentServiceImpl;

@Controller
@RequestMapping(value = "/department")
public class DepartmentController {
	
	private IDepartmentService departmentService = new DepartmentServiceImpl();
	
	@RequestMapping(value = "/deleteAll")
	@ResponseBody
	public ServerResponse deleteAll(String ids){
		ServerResponse response = departmentService.deleteAll(ids);
		return response;
	}
	
	@RequestMapping(value = "/getAddDepartmentPage")
	public String addDepartment(){
		return "department_add";
	}
	
	@RequestMapping(value = "/addDepartment")
	@ResponseBody
	public ServerResponse addDepartment(Department department){
		ServerResponse response = departmentService.addDepartment(department);
		return response;
	}
	
	@RequestMapping(value = "/getDepartmentList")
	@ResponseBody
	public ServerResponse getDepartmentList(Integer page,Integer limit){
		ServerResponse response = departmentService.getDepartmentList(page,limit);
		return response;
	}
}
